<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="../layui/css/layui.css">
</head>

<body>
    <header class="layui-bg-black" style="display: flex;justify-content: space-between;
    color:#fff;align-items: center;padding: 0px 20px;">
        <div style="font-size:24px;">
            LOGO
        </div>
        <ul class="layui-nav" lay-filter="">
            <li class="layui-nav-item"><a href="">最新活动</a></li>
            <li class="layui-nav-item"><a href="">产品</a></li>
            <li class="layui-nav-item"><a href="">大数据</a></li>
            <li class="layui-nav-item  layui-this">
                <a href="javascript:;">解决方案</a>
                <dl class="layui-nav-child">
                    <!-- 二级菜单 -->
                    <dd><a href="">移动模块</a></dd>
                    <dd><a href="">后台模版</a></dd>
                    <dd><a href="">电商平台</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="">社区</a></li>
        </ul>
    </header>
    <section style="display: flex;height:calc(100vh - 60px);">
        <nav style="width:200px;" class="layui-bg-black">
            <ul class="layui-nav layui-nav-tree" lay-shrink="all" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a href="javascript:;">用户管理</a>
                    <dl class="layui-nav-child">
                        <dd><a target="main" href="javascript:;" data-id="userlist"
                                data-href="pages/userlist.html">用户列表</a></dd>
                        <dd><a target="main" href="javascript:;" data-id="userstatistic"
                                data-href="pages/userstatistic.html">用户统计</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">解决方案</a>
                    <dl class="layui-nav-child">
                        <dd><a href="">移动模块</a></dd>
                        <dd><a href="">后台模版</a></dd>
                        <dd><a href="">电商平台</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="">产品</a></li>
                <li class="layui-nav-item"><a href="">大数据</a></li>
            </ul>
        </nav>
        <article style="flex:1;padding:0 10px;display: flex;">
            <div class="layui-tab layui-tab-brief" lay-filter="demo" lay-allowClose="true">
                <ul class="layui-tab-title">

                </ul>
                <div class="layui-tab-content">

                </div>
            </div>
        </article>
    </section>
    <script src="../layui/layui.js"></script>
    <script>
        layui.use(['element', 'layer', 'jquery'], function () {
            top.layer = layui.layer
            var element = layui.element
            var $ = layui.jquery

            $('[data-href]').click(function () {

                if ($(`[lay-id="${$(this).data("id")}"]`).length === 0) {
                    element.tabAdd('demo', {
                        title: $(this).text(),
                        content: `
                    <iframe name="main" src="${$(this).data("href")}" frameborder="0" scrolling="no"
                        style="width:calc(100vw - 230px);height:calc(100vh - 60px)"></iframe>
                    `,
                        id: $(this).data("id")
                    });
                }

                element.tabChange('demo', $(this).data("id"));
            })

        })
    </script>
</body>

</html>